package Player;

import org.newdawn.slick.Animation;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Input;
import org.newdawn.slick.geom.Rectangle;


public class Player extends Animation{
	private float playerX=0;
	private float playerY=0;
	private float velocityX;
	private float velocityY;
	private float boundingBoxPlayerX;
	private float boundingBoxPlayerY;
	GameContainer container;
	public Rectangle boundingBoxPlayer;

	public Player(GameContainer container, float playerX, float playerY) {
		super();
		this.setPlayerX(playerX);
		this.setPlayerY(playerY);
		this.container = container;
		boundingBoxPlayerX = playerX;
		boundingBoxPlayerY =  playerY;
		boundingBoxPlayer = new Rectangle(boundingBoxPlayerX,boundingBoxPlayerY, 32, 32);
	}

	public float getPlayerX() {
		return playerX;
	}

	public void setPlayerX(float playerX) {
		this.playerX = playerX;
	}

	public float getPlayerY() {
		return playerY;
	}

	public void setPlayerY(float playerY) {
		this.playerY = playerY;
	}

	public float getVelocityX() {
		return velocityX;
	}

	public void setVelocityX(float velocityX) {
		this.velocityX = velocityX;
	}

	public float getVelocityY() {
		return velocityY;
	}

	public void setVelocityY(float velocityY) {
		this.velocityY = velocityY;
	}


	public void setBoundingBoxPlayerX(float boundingBoxPlayerX){
		this.boundingBoxPlayerX = boundingBoxPlayerX;
	}

	public float getBoundingBoxPlayerX(){
		return boundingBoxPlayerX;
	}


	public void setBoundingBoxPlayerY(float boundingBoxPlayerY){
		this.boundingBoxPlayerY = boundingBoxPlayerY;
	}

	public float getBoundingBoxPlayerY(){
		return boundingBoxPlayerY;
	}

	public void updatePlayer(){

		this.playerX += this.velocityX;
		this.playerY += this.velocityY;
		
		this.boundingBoxPlayerX = this.playerX;
		this.boundingBoxPlayerY = this.playerY;

		this.velocityX = 0;
		this.velocityY = 0;

		if (container.getInput().isKeyDown(Input.KEY_LEFT)){
			this.velocityX = -2;

		}

		if (container.getInput().isKeyDown(Input.KEY_RIGHT)){
			this.velocityX = 2;


		}

		if(container.getInput().isKeyDown(Input.KEY_UP)){
			this.velocityY = -2;


		}

		if(container.getInput().isKeyDown(Input.KEY_DOWN)){
			this.velocityY = 2;


		}
	}
}

